<!-- 积分 -->
<template>
	<view class="multiple-page">
		<view style="height: 20rpx;background-color:#fff;"></view>
		<view class="multiple-page-list" v-for="(item,index) in scoreLog" :key="index" >
			<view class="multiple-time">
				{{$u.timeFormat(item.createtime, 'mm月dd日 hh:MM')}}
			</view>
			<view v-if="item.wallet>=0" class="multiple-num0">
				+{{item.wallet}}
			</view>
			<view v-if="item.wallet<0" class="multiple-num1">
				{{item.wallet}}
			</view>
		</view>
		<view style="height: 70rpx;background-color:#fff;position: fixed;bottom: 0;z-index: 2;width: 100%;"></view>
	</view>
	
</template>

<script>

import { mapMutations, mapActions, mapState, mapGetters } from 'vuex';
export default {
	components: {
	},
	data() {
		return {
			isEmpty: false,
			tabCur: 'all',
			scoreLog: [],
			loadStatus: 'loadmore', //loadmore-加载前的状态，loading-加载中的状态，nomore-没有更多的状态
			currentPage: 1,
			lastPage: 1
		};
	},
	// 是否登录
	computed: {
		...mapGetters(['isLogin', 'authType']),
	},
	onLoad(e){
		let that = this;
		this.getScoreLog();
	},
	methods: {
		// 检测
		checkActivity(data, type) {
			if (data) {
				return !data.includes(type);
			}
			return true;
		},
		// 路由跳转
		jump(path, parmas) {
			this.showShare = false;
			this.$Router.push({
				path: path,
				query: parmas
			});
		},
		// 回到首页
		goHome() {
			this.$Router.replaceAll('/pages/index/index');
		},

		// 选项卡
		onTab(id) {
			this.tabCurrent = id;
		},
		
		// 组件返回的type;
		changeType(e) {
			this.buyType = e;
		},
		// 组件返回的规格;
		getSkuText(e) {
			this.currentSkuText = e;
		},
		loadMore() {
			if (this.currentPage < this.lastPage) {
				this.currentPage += 1;
				this.getScoreLog();
			}
		},
		onTab(type) {
			if (this.tabCur !== type) {
				this.tabCur = type;
				this.scoreLog = [];
				this.currentPage = 1;
				this.getScoreLog();
			}
		},
		// 积分明细
		getScoreLog(type) {
			let that = this;
			that.loadStatus = 'loading';
			that.$http('money.walletLog', {
				wallet_type: 'score',
				status: that.tabCur,
				page: that.currentPage
			}).then(res => {
				if (res.code === 1) {
					that.scoreLog = [...that.scoreLog, ...res.data.wallet_logs.data];
					that.lastPage = res.data.last_page;
					that.isEmpty = !that.scoreLog.length;
					that.loadStatus = that.currentPage < res.data.last_page ? 'loadmore' : 'nomore';
				console.log(that.scoreLog)
				}
			});
		}
	}
};
</script>

<style lang="scss">
.multiple-page{
	// position: relative;
	background-color:#fff;
	min-height: 100%;
	padding-bottom: 70rpx;
}
.multiple-page-list{
	padding: 25rpx 0 25rpx 0;
	margin: 0 40rpx 0 40rpx;
	background-color:#fff;
	color: #444;
	border-bottom: 2rpx solid rgba(255, 255, 255, 0.1);
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.multiple-num0{
	color: #444;
	font-size: 31rpx;
	line-height: 38rpx;
}
.multiple-num1{
	color: #444;
	font-size: 31rpx;
	line-height: 38rpx;
}
.multiple-time{
	font-size: 31rpx;
	line-height: 38rpx;
}
</style>
